package com.softserveinc.dao.mapper;

import com.softserveinc.model.Role;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.security.core.GrantedAuthority;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * Role row mapper
 */
public class RoleRowMapper implements RowMapper<GrantedAuthority> {
    /**
     * Extracts data from database
     * @param resultSet - for etracting
     * @param i - row index
     * @return  extracted Role data from RS
     * @throws SQLException
     */
    @Override
    public Role mapRow(ResultSet resultSet, int i) throws SQLException {
        RoleResultSetExtractor extractor = new RoleResultSetExtractor();
        return extractor.extractData(resultSet);
    }
}
